﻿@model ScmCostplanViewModel
@{
    Layout = null;
    ViewBag.Title = "费用计划-查看";
    int num = 1;
}
<style type="text/css">
    .tr_hj td {
        font-weight: 600;
        text-align: center;
    }
</style>

<form method="post" action="demo/common/ajaxDone.html" class="pageForm required-validate" onsubmit="return validateCallback(this)">
   <div class="pageContent">
        <div class="pageFormContent" layouth="60">
            <dl>
                <dt style="text-align:right">标段：</dt>
                <dd>
                    @Html.TextBoxFor(model => model.TheScmCostplanmainInfo.Cpm_Section)   </dd>
            </dl>
            <dl>
                <dt style="text-align:right">施工单位：</dt>
                <dd>
                    @Html.TextBoxFor(model => model.TheScmCostplanmainInfo.Cpm_ConstructionName) </dd>
            </dl>
            <dl style="display:none">
                <dt>操作人：</dt>
                <dd>
                    @Html.TextBoxFor(model => model.TheScmCostplanmainInfo.Cpm_OperateUserName)   </dd>
            </dl>
            <dl style="text-align:right">
                <dt>上报时间：</dt>
                <dd>
                    @Html.TextBoxFor(model => model.TheScmCostplanmainInfo.Cpm_ReportTime,
                    new { @class = "date", @readonly = "readonly", Value = Model.TheScmCostplanmainInfo.Cpm_ReportTime.ToString("yyyy-MM-dd") })
                </dd>
            </dl>
            <dl style="text-align:right">
                <dt>年份：</dt>
                <dd>
                    @Html.TextBoxFor(model => model.TheScmCostplanmainInfo.Cpm_YearMonth,
                    new { @class = "text", @readonly = "readonly", Value = Model.TheScmCostplanmainInfo.Cpm_YearMonth.ToString("yyyy年M月") })
                </dd>
           </dl>
            <dl>
                <dt style="text-align:right">审批人：</dt>
                <dd>
                     @Html.TextBoxFor(model => model.TheScmAuditInfo.A_ManName)</dd>
            </dl>
            <dl>
                <dt style="text-align:right">审批时间：</dt>
                <dd>
                    <input name="riqi" type="text" readonly="readonly" value="@(Model.TheScmAuditInfo.A_Time.Year == 1 ?"":Model.TheScmAuditInfo.A_Time.ToString("yyyy-MM-dd"))" /></dd>
            </dl>
            <dl>
                <dt style="text-align:right">审批：</dt>
                <dd>
                <input type="text" readonly="readonly" id="sel_pro" value="@(Model.TheScmCostplanmainInfo.Cpm_State==0?"未审批":(Model.TheScmCostplanmainInfo.Cpm_State==2?"审批不通过":"审批通过"))" ></dd>
            </dl>
            <dl class="nowrap">
                <dt style="text-align:right">审批意见：</dt>
                <dd>
                     @Html.TextBoxFor(model => model.TheScmAuditInfo.A_Opinion, new { @size="52"})
                </dd>
            </dl>
        
            <div class="divider"></div>
          
            <div class="tabs">
                <div class="tabsHeader">
                    <div class="tabsHeaderContent">
                        <ul>
                            <li class="selected"><a href="javascript:void(0)"><span>费用统计表</span></a></li>
                          @*  <li><a href="javascript:void(0)"><span>审批意见</span></a></li>*@
                        </ul>
                    </div>
                </div>
                <div class="tabsContent" style="height: 350px;">
                    <div>
                        <table class="list nowrap" width="100%" nowraptd="false">
                            <thead>
                                <tr>
                                    <th  style="text-align:center" width="30">序号</th>
                                    <th style="text-align:center" width="300">凭证名目</th>
                                    <th style="text-align:center" width="80">金额</th>
                                    <th style="text-align:center" width="80">追加金额</th>
                                    <th style="text-align:center" width="80">扣除金额</th>
                                    <th style="text-align:center" width="80">实际金额</th>
                                    <th style="text-align:center" width="80">备注</th>
                                </tr>
                            </thead>
                            <tbody>
                                  @for (int index = 0; index < Model.TheCostPlanList.Count; index++)
                                {
                           
                                    <tr>
                                        <td style="text-align:center"> <input type="text" style="border:none;text-align:center" name="TheCostPlanList[@index].itemInt" value=@num defaultVal="#index#" size="1" fieldClass="digits"></input></td>
                                        <td style="text-align:center"><input type="text" style="border:none;text-align:center" size="50" name="TheCostPlanList[@index].Cp_Item" width="200" fieldclass="required" value=@Model.TheCostPlanList[index].Cp_Item></input></td>
                                        <td style="text-align:center"><input type="text" style="border:none;text-align:right" size="12" defaultVal="0.0" width="80" fieldClass="number" name="TheCostPlanList[@index].Cp_Amount" value=@Model.TheCostPlanList[index].Cp_Amount  ></input></td>
                                         <td style="text-align:center"><input type="text" style="border:none;text-align:right" size="12"   defaultVal="0.0" width="80" fieldClass="number" name="TheCostPlanList[@index].Cp_Add" value=@Model.TheCostPlanList[index].Cp_Add ></input></td>
                                         <td style="text-align:center"><input type="text" style="border:none;text-align:right" size="12"   defaultVal="0.0" width="80" fieldClass="number" name="TheCostPlanList[@index].Cp_Deduct" value=@Model.TheCostPlanList[index].Cp_Deduct  ></input></td>
                                         <td style="text-align:center"><input type="text" style="border:none;text-align:right;" size="12" defaultVal="0.0" width="80"  fieldClass="number" name="TheCostPlanList[@index].Cp_ActualAmount" value=@Model.TheCostPlanList[index].Cp_ActualAmount  ></input></td>
                                        <td style="text-align:center"><input type="text" style="border:none;text-align:center" size="12" name="TheCostPlanList[@index].Cp_Remark" value=@Model.TheCostPlanList[index].Cp_Remark ></input></td>
                                       
                                    </tr>
                                    num++;
                                }
                                  <tr>
                                    <td colspan="2" style="text-align:center"><h3>合计</h3></td>
                                     <td style="text-align:center" ><input type="text" style="border:none;text-align:right;font-weight:bold;" size="12" defaultVal="0.0" width="80" fieldClass="number" name="Cp_Amount" value=""  ></input></td>
                                     <td style="text-align:center"><input type="text" style="border:none;text-align:right;font-weight:bold;" size="12" defaultVal="0.0" width="80" fieldClass="number" name="Cp_Add" value=""  ></input></td>
                                     <td style="text-align:center"><input type="text" style="border:none;text-align:right;font-weight:bold;" size="12" defaultVal="0.0" width="80" fieldClass="number" name="Cp_Deduct" value=""  ></input></td>
                                     <td style="text-align:center"><input type="text" style="border:none;text-align:right;font-weight:bold;" size="12" defaultVal="0.0" width="80" fieldClass="number" name="Cp_ActualAmount" value=""  ></input></td>
                                    <td></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div>
                        <table class="table" width="100%" nowraptd="false">
                            <thead>
                                <tr>
                                    <th width="30">序号</th>
                                    <th width="110">审批部门</th>
                                    <th width="110">审批人</th>
                                    <th width="110">审批时间</th>
                                    <th width="110">审批</th>
                                    <th>审批意见</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>1</td>
                                    <td>施工单位1</td>
                                    <td>管理员</td>
                                    <td>2016-11-28</td>
                                    <td>审批通过</td>
                                    <td>2016年1月份计划使用安监费，请总监办审批</td>
                                </tr>
                                <tr>
                                    <td>2</td>
                                    <td>总监办</td>
                                    <td>管理员</td>
                                    <td>2016-12-02</td>
                                    <td>审批通过</td>
                                    <td>计划使用安监费符合实际情况，请安监部审批</td>
                                </tr>
                                <tr>
                                    <td>3</td>
                                    <td>安监部</td>
                                    <td>管理员</td>
                                    <td>2016-12-02</td>
                                    <td>审批通过</td>
                                    <td>同意本次费用计划，审批通过</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="tabsFooter">
                    <div class="tabsFooterContent"></div>
                </div>
            </div>
      </div>
        <div class="formBar">
            <ul>
                <li>
                    <button type="button" class="close btn btn-default btn-sm">关闭</button>
                </li>
            </ul>
        </div>
   </div>
</form>
<script type="text/javascript">
    $(document).ready(function () {
        onload();
     });
    function onload() {
        var Aamount = 0, AAddamount = 0, ADeductamount = 0, AAllamount = 0;
        for (var i = 0; i < @num -1; i++) {
             var amount = "TheCostPlanList[" + i + "].Cp_Amount";
             var Addamount = "TheCostPlanList[" + i + "].Cp_Add";
             var Deductamount = "TheCostPlanList[" + i + "].Cp_Deduct";
             var Allamount = "TheCostPlanList[" + i + "].Cp_ActualAmount";

             var Vamount = $(document.getElementsByName(amount)).val();
             var VAddamount = $(document.getElementsByName(Addamount)).val();
             var VDeductamount = $(document.getElementsByName(Deductamount)).val();
             var VAllamount = $(document.getElementsByName(Allamount)).val();
             if (Vamount == null || Vamount == "") {
                 Vamount = 0;
             }
             if (VAddamount == null || VAddamount == "") {
                 VAddamount = 0;
             }
             if (VDeductamount == null || VDeductamount == "") {
                 VDeductamount = 0;
             }
             if (VAllamount == null || VAllamount == "") {
                 VAllamount = 0;
             }
             Aamount += parseFloat(Vamount);
             AAddamount += parseFloat(VAddamount);
             ADeductamount += parseFloat(VDeductamount) * (-1);
             AAllamount += parseFloat(VAllamount);
         }
         $(document.getElementsByName("Cp_Amount")).val(Aamount.toString());
         $(document.getElementsByName("Cp_Add")).val(AAddamount.toString());
         $(document.getElementsByName("Cp_Deduct")).val(ADeductamount.toString());
         $(document.getElementsByName("Cp_ActualAmount")).val(AAllamount.toString());
    }
</script>